package com.legendframework.core.dao.page;

import java.io.Serializable;
import java.util.List;

/**
 * 分页对象
 */
public class Page<T> implements Serializable {

    /**
     * 页码(1开始)
     */
    private long currentPage;

    /**
     * 每页条目数
     */
    private long itemNum;

    /**
     * 总页数
     */
    private long totalPage;

    /**
     * 总记录数
     */
    private long totalSum;

    /**
     * 分页后数据
     */
    private List<T> list;

    public Page(long currentPage, long itemNum) {
        this.currentPage = currentPage;
        this.itemNum = itemNum;
    }

    public long getCurrentPage() {
        return currentPage;
    }

    public void setCurrentPage(long currentPage) {
        this.currentPage = currentPage;
    }

    public long getItemNum() {
        return itemNum;
    }

    public void setItemNum(long itemNum) {
        this.itemNum = itemNum;
    }

    public long getTotalPage() {
        return totalPage;
    }

    public void setTotalPage(long totalPage) {
        this.totalPage = totalPage;
    }

    public long getTotalSum() {
        return totalSum;
    }

    public void setTotalSum(long totalSum) {
        this.totalSum = totalSum;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }

    @Override
    public String toString() {
        return "Page{" +
                "currentPage=" + currentPage +
                ", itemNum=" + itemNum +
                ", totalPage=" + totalPage +
                ", totalSum=" + totalSum +
                ", list=" + list +
                '}';
    }
}
